<template>
    <div class="big-box">
        <div class="header">
            <img src="../../../../../assets/bigScreen/header2.png" alt="" />
            <div class="backBox" @click="goBack"></div>
        </div>
        <div class="backToBox">
            <div class="backTo" @click="gotoHome">
                <div>返回总窗口</div>
            </div>
            <div class="backTo" @click="backToOne">
                <div>返回上一页</div>
            </div>
        </div>
        <div class="centerBox">
            <div class="sreenTitle">{{ route.query.name }}</div>
            <div class="center">
                <div class="org-info-box">
                    <div class="org-info-inner" id="title">
                        <img
                        class="org-left-img"
                        :src="
                            dataMap.imgList[0]
                            ? dataMap.imgList[0][0] == '/'
                                ? baseURL + dataMap.imgList[0]
                                : dataMap.imgList[0]
                            : '../../../../../assets/informition/real-default.png'
                        "
                        alt="暂无图片"
                        />
                        <div class="org-info-right">
                            <div class="org-info-name">
                                <span>{{ dataMap.detail.name }}</span>
                                <!-- <div class="refer">立即咨询</div> -->
                            </div>
                            <div class="org-info-tag-box">
                                <div class="org-info-tag">
                                    <img src="../../../../../assets/serviceOrgDetail/icon4.png" alt="" />
                                    <span>机构类型：{{ dataMap.detail.orgClass }}</span>
                                </div>
                                <div class="org-info-tag">
                                    <img src="../../../../../assets/serviceOrgDetail/icon1.png" alt="" />
                                    <span>所在地点：{{ dataMap.detail.address }}</span>
                                </div>
                                <div class="org-info-tag">
                                    <img src="../../../../../assets/serviceOrgDetail/icon2.png" alt="" />
                                    <span>服务类型：{{ dataMap.detail.type || "暂无" }}</span>
                                </div>
                            </div>
                            <div class="org-info-tag-box">
                                <div class="org-info-tag">
                                    <img src="../../../../../assets/serviceOrgDetail/icon3.png" alt="" />
                                    <span>行业领域：{{ dataMap.detail.industry }}</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="container">
                    <div class="box-title" id="container">
                        <img src="../../../../../assets/serviceOrgDetail/icon5.png" alt="" />
                        <span>机构简介</span>
                    </div>
                    <div class="detail-text" v-html="dataMap.detail.content"></div>
                    <div class="box-title" id="image">
                        <img src="../../../../../assets/serviceOrgDetail/icon5.png" alt="" />
                        <span>机构图片</span>
                    </div>
                    <div class="swiper-box">
                        <a-carousel arrows>
                            <template #prevArrow>
                                <div class="custom-slick-arrow" style="left: 10px; z-index: 1">
                                <left-circle-outlined />
                                </div>
                            </template>
                            <template #nextArrow>
                                <div class="custom-slick-arrow" style="right: 10px">
                                <right-circle-outlined />
                                </div>
                            </template>
                            <div
                                class="swiper-item"
                                v-for="(item, index) in dataMap.imgList"
                                :key="index"
                            >
                                <!-- <img :src="item" alt="" /> -->
                                <img
                                :src="
                                    item
                                    ? item[0] == '/'
                                        ? baseURL + item
                                        : item
                                    : '../../../../../assets/informition/real-default.png'
                                "
                                alt="暂无图片"
                                />
                            </div>
                        </a-carousel>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import { getOrgDetail } from "../../../../../api/scientificResearch.js";
import { ref, reactive,onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import axios from "axios";
const router = useRouter()
const pageAct = ref(1)
const dates = ref('')
const route = useRoute()

const baseURL = axios.defaults.baseURL;

const dataMap = reactive({
    id: route.query.id,
    detail: {},
    imgList: [],
});

const getDetail = async () => {
    await getOrgDetail(dataMap.id).then((res) => {
        dataMap.detail = res.data
        dataMap.imgList = res.data.imgUrls.split(",")
    });
};

//判断时间是否为个位数，如果时间为个位数就在时间之前补上一个“0”
const check = (val) => {
    if (val < 10) {
        return '0' + val
    } else {
        return val
    }
}

const gotoScreen = (act) => {
    router.push({
        path: '/bigScreen',
        query: {
            act: act,
        },
    })
}
const gotoHome = (act) => {
    router.push({
        path: '/bigScreenIndex',
    })
}
const backToOne = (act) => {
    router.go(-1)
}

const goBack = () => {
    router.push('/chart')
}

// gotoHome() {
//             router.push({
//                 path: '/bigScreenIndex',
//             })
//         },
//         backToOne() {
//             router.go(-1)
//         },

const displayTime = () => {
    //获取系统当前的年、月、日、小时、分钟、毫秒
    let date = new Date()
    let year = date.getFullYear()
    let month = date.getMonth() + 1
    let day = date.getDate()
    let hour = date.getHours()
    let minutes = date.getMinutes()
    let seconds = date.getSeconds()
    dates.value = `${year}年${month}月${day}日 ${check(hour)}:${check(minutes)}:${check(seconds)}`
}
//每隔1秒调用一次displayTime函数
const start = () => {
    setInterval(() => {
        displayTime()
    }, 1000) //单位是毫秒
}
onMounted(() => {
    start()
    getDetail()
})
</script>

<style scoped lang="scss">
@font-face {
    font-family: "ffa";
    src: url(../../../assets/bigScreen/fonts/DS-DIGIB.TTF);
}
ul,
li {
    list-style: none;
}
.big-box {
    background-color: #071c3b;
    height: 100vh;
}
.header {
    position: relative;
    text-align: center;
    position: relative;
    height: 19.1rem;

    .backBox {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 70rem;
        height: 10rem;
        cursor: pointer;
    }

    > img {
        width: 100%;
        max-height: 100%;
        margin-top: -1.1rem;
        image-rendering: -moz-crisp-edges; /* Firefox */
        image-rendering: -o-crisp-edges; /* Opera */
        image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming) */
        image-rendering: crisp-edges;
        -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */
    }
}
.centerBox {
    width: 96%;
    margin: 0 auto;
    position: absolute;
    top: 14rem;
    left: 2%;
    .sreenTitle {
        background-image: url("../../../../../assets/bigScreen/sreenTitle.png");
        background-size: 100% 100%;
        height: 3.8rem;
        padding-left: 35px;
        font-weight: 600;
        color: #fff;
        display: flex;
        align-items: center;
    }
    .center {
        margin-top: 1rem;
        height: calc(100vh - 20rem);
        border: 1px solid;
        border-image: linear-gradient(
                130deg,
                #2385df 0%,
                rgba(35, 133, 223, 0.65) 92%
            )
            1;
        overflow: auto;
    }

    .center::-webkit-scrollbar {
        display: none;
    }
}
.backToBox {
    position: absolute;
    top: 8rem;
    right: 2%;
    display: flex;
    .backTo {
        background-image: url("../../../../../assets/bigScreen/backTo.png");
        color: #2dccff;
        background-size: 100% 100%;
        width: fit-content;
        padding: 2px 40px 10px 10px;
        font-weight: 600;
        cursor: pointer;
        margin-left: 10px;
        div {
            padding-top: 5px;
        }
    }
}
.org-info-box {
  width: 100%;
  height: 24rem;
  background-size: cover;
//   background-image: url(../../../../../assets/serviceOrgDetail.png);

  .org-info-inner {
    display: flex;
    align-items: center;
    width: 136rem;
    height: 100%;
    margin: 0 auto;
    padding: 0 10rem;

    .org-left-img {
      width: 15rem;
      height: 15rem;
      border-radius: 50%;
      margin-right: 3.7rem;
      object-fit: cover;
    }
  }

  .org-info-right {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .org-info-name {
    display: flex;
    justify-content: left;
    align-items: center;
    font-size: 3.2rem;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 3rem;

    .refer {
      width: 9rem;
      height: 3rem;
      border-radius: 4px;
      background: #037aff;
      color: #ffffff;
      font-size: 1.6rem;
      text-align: center;
      line-height: 3rem;
      margin-left: 4rem;
      font-weight: normal;
    }
  }

  .org-info-tag-box {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;

    .org-info-tag {
      display: flex;
      align-items: center;
      margin-right: 2rem;
      color: #d4d4d4;

      img {
        width: 1.8rem;
        height: auto;
        margin-right: 1rem;
      }
    }
  }
}

.container {
  width: 136rem;
  margin: 0 auto;
//   background-color: #ffffff;
}

.box-title {
  width: 100%;
  height: 6.5rem;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #1D71C0;

  img {
    width: 2.5rem;
    height: 2.5rem;
    margin-right: 1rem;
  }

  span {
    font-size: 1.8rem;
    color: #037aff;
    font-weight: bold;
  }
}

.detail-text {
  padding: 2rem 4rem;
  font-size: 1.6rem;
  color: #d4d4d4;
  text-indent: 2em;
}

.swiper-box {
  padding: 2rem;
}

.swiper-item {
  width: 100%;
  height: 50rem;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.ant-carousel :deep(.slick-slide) {
  text-align: center;
  height: 50rem;
  background: #ededed;
  overflow: hidden;
}

.ant-carousel :deep(.slick-arrow.custom-slick-arrow) {
  width: 25px;
  height: 25px;
  font-size: 25px;
  color: #fff;
  background-color: rgba(31, 45, 61, 0.11);
  opacity: 0.3;
  z-index: 1;
}

.ant-carousel :deep(.custom-slick-arrow:before) {
  display: none;
}

.ant-carousel :deep(.custom-slick-arrow:hover) {
  opacity: 0.5;
}

.ant-carousel :deep(.slick-slide h3) {
  color: #fff;
}
</style>
